package com.zjy.health_ms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zjy.health_ms.mapper.UserMapper;
import com.zjy.health_ms.pojo.User;
import com.zjy.health_ms.service.UserService;
import com.zjy.health_ms.utils.MD5Utils;
import org.springframework.stereotype.Service;

/**
 * @program: health_ms
 * @ClassName UserServiceImpl
 * @description:
 * @author: Ats
 * @create: 2025-05-12 14:06
 * @Version 1.0
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Override
    public User login(String username, String password) {
        //登录的业务逻辑
        LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(User::getUsername,username);
        queryWrapper.eq(User::getPassword, MD5Utils.md5(password));
        User user = baseMapper.selectOne(queryWrapper);
        return user;
    }
}
